package de.multidb.connection;

import java.sql.*;

public class Connector {
	
	/**
	 * @param args
	 */
	public static void main(String[] args) throws ClassNotFoundException, SQLException {
		String username = "MultimediaDB";
		String password = "qwertz1234";
		
		String tablename = "xxx";
		String fieldname = "xxxx";
		String query = "SELECT" + fieldname + "FROM" + tablename + ";";
		
		String url = "jdbc:mysql://db4free.net:3306/" + username + password;
		Class.forName("com.mysql.jdbc.Driver");
		Connection con = DriverManager.getConnection(url, username, password);
		Statement stmt = con.createStatement();
		
		ResultSet rs = stmt.executeQuery(query);

		System.out.println("The contents of field" + fieldname + ":");
		while(rs.next())
			System.out.print(rs.getString(1) + ", ");

		System.out.println();

		rs.close();
		stmt.close();
		con.close();
		}
}
